<?php

use App\Enums\OpenShop\InvestmentPromotion\SiteLocationEnum;
use App\Models\OpenShop\SiteLocation\OpenShopSiteLocationModel;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Jialeo\LaravelSchemaExtend\Schema;

class AlterTableAddCapitalBudgetingToSiteLocation extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::table('open_shop_site_locations', function (Blueprint $table) {
            $table->unsignedInteger('waterFeeMonth')->default(10000)->after("siteInferiority")
                  ->comment("水费/月");
            $table->unsignedInteger('electricityFeeMonth')->default(120000)->after("siteInferiority")
                  ->comment("电费/月");
            $table->unsignedTinyInteger('shopManagerCount')->default(0)->after("siteInferiority")
                  ->comment("店长数量");
            $table->unsignedInteger('shopManagerMonthSalary')->default(0)->after("siteInferiority")
                  ->comment("店长月薪");
            $table->unsignedTinyInteger('shopAssistantCount')->default(0)->after("siteInferiority")
                  ->comment("店员数量");
            $table->unsignedInteger('shopAssistantMonthSalary')->default(0)->after("siteInferiority")
                  ->comment("店员月薪");
            $table->unsignedTinyInteger('foodstuffMarginRate')->default(65)->after("siteInferiority")
                  ->comment("食材毛利率");
            $table->unsignedTinyInteger('customerUnitPriceEstimation')->default(0)->after("siteInferiority")
                  ->comment(enumToMigrationComment(SiteLocationEnum::CUSTOMER_UNIT_PRICE_ESTIMATION_MAP, "客单价预估"));

        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::table('open_shop_site_locations', function (Blueprint $table) {
            $table->dropColumn('waterFeeMonth');
            $table->dropColumn('electricityFeeMonth');
            $table->dropColumn('shopManagerCount');
            $table->dropColumn('shopManagerMonthSalary');
            $table->dropColumn('shopAssistantCount');
            $table->dropColumn('shopAssistantMonthSalary');
            $table->dropColumn('foodstuffMarginRate');
            $table->dropColumn('customerUnitPriceEstimation');

        });
    }
}
